package org.framework.lazy.cloud.network.heartbeat.server.standalone.controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.framework.lazy.cloud.network.heartbeat.server.standalone.application.LazyNettyServerPermeatePortPoolApplication;
import org.framework.lazy.cloud.network.heartbeat.server.standalone.application.command.lazy.netty.server.permeate.port.pool.*;
import org.framework.lazy.cloud.network.heartbeat.server.standalone.application.dto.LazyNettyServerVisitorDTO;
import org.framework.lazy.cloud.network.heartbeat.server.standalone.domain.model.lazy.netty.server.permeate.port.pool.LazyNettyServerPermeatePortPool;
import org.springframework.web.bind.annotation.*;
import org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyController;
import org.wu.framework.lazy.orm.database.lambda.domain.LazyPage;
import org.wu.framework.web.response.Result;
import org.wu.framework.web.spring.EasyController;

import java.util.List;

/**
 * describe 服务端提前开放出来的端口
 *
 * @author Jia wei Wu
 * @date 2024/01/16 02:21 下午
 * @see DefaultDDDLazyController
 **/
@Tag(name = "服务端提前开放出来的端口提供者")
@EasyController("/lazy/netty/server/permeate/port/pool")
public class LazyNettyServerPermeatePortPoolProvider {

    @Resource
    private LazyNettyServerPermeatePortPoolApplication lazyNettyServerPermeatePortPoolApplication;

    /**
     * describe 新增服务端提前开放出来的端口
     *
     * @param lazyNettyServerPermeatePortPoolStoryCommand 新增服务端提前开放出来的端口
     * @return {@link Result<  LazyNettyServerPermeatePortPool  >} 服务端提前开放出来的端口新增后领域对象
     * @author Jia wei Wu
     * @date 2024/01/16 02:21 下午
     **/

    @Operation(summary = "新增服务端提前开放出来的端口")
    @PostMapping("/story")
    public Result<LazyNettyServerPermeatePortPool> story(@RequestBody LazyNettyServerPermeatePortPoolStoryCommand lazyNettyServerPermeatePortPoolStoryCommand) {
        return lazyNettyServerPermeatePortPoolApplication.story(lazyNettyServerPermeatePortPoolStoryCommand);
    }

    /**
     * describe 批量新增服务端提前开放出来的端口
     *
     * @param lazyNettyServerPermeatePortPoolStoryCommandList 批量新增服务端提前开放出来的端口
     * @return {@link Result<List<  LazyNettyServerPermeatePortPool  >>} 服务端提前开放出来的端口新增后领域对象集合
     * @author Jia wei Wu
     * @date 2024/01/16 02:21 下午
     **/

    @Operation(summary = "批量新增服务端提前开放出来的端口")
    @PostMapping("/batchStory")
    public Result<List<LazyNettyServerPermeatePortPool>> batchStory(@RequestBody List<LazyNettyServerPermeatePortPoolStoryCommand> lazyNettyServerPermeatePortPoolStoryCommandList) {
        return lazyNettyServerPermeatePortPoolApplication.batchStory(lazyNettyServerPermeatePortPoolStoryCommandList);
    }

    /**
     * describe 更新服务端提前开放出来的端口
     *
     * @param lazyNettyServerPermeatePortPoolUpdateCommand 更新服务端提前开放出来的端口
     * @return {@link Result<  LazyNettyServerPermeatePortPool  >} 服务端提前开放出来的端口领域对象
     * @author Jia wei Wu
     * @date 2024/01/16 02:21 下午
     **/

    @Operation(summary = "更新服务端提前开放出来的端口")
    @PutMapping("/updateOne")
    public Result<LazyNettyServerPermeatePortPool> updateOne(@RequestBody LazyNettyServerPermeatePortPoolUpdateCommand lazyNettyServerPermeatePortPoolUpdateCommand) {
        return lazyNettyServerPermeatePortPoolApplication.updateOne(lazyNettyServerPermeatePortPoolUpdateCommand);
    }

    /**
     * describe 查询单个服务端提前开放出来的端口
     *
     * @param lazyNettyServerPermeatePortPoolQueryOneCommand 查询单个服务端提前开放出来的端口
     * @return {@link Result< LazyNettyServerVisitorDTO >} 服务端提前开放出来的端口DTO对象
     * @author Jia wei Wu
     * @date 2024/01/16 02:21 下午
     **/

    @Operation(summary = "查询单个服务端提前开放出来的端口")
    @GetMapping("/findOne")
    public Result<LazyNettyServerVisitorDTO> findOne(@ModelAttribute LazyNettyServerPermeatePortPoolQueryOneCommand lazyNettyServerPermeatePortPoolQueryOneCommand) {
        return lazyNettyServerPermeatePortPoolApplication.findOne(lazyNettyServerPermeatePortPoolQueryOneCommand);
    }

    /**
     * describe 查询多个服务端提前开放出来的端口
     *
     * @param lazyNettyServerPermeatePortPoolQueryListCommand 查询多个服务端提前开放出来的端口
     * @return {@link Result<List< LazyNettyServerVisitorDTO >>} 服务端提前开放出来的端口DTO对象
     * @author Jia wei Wu
     * @date 2024/01/16 02:21 下午
     **/

    @Operation(summary = "查询多个服务端提前开放出来的端口")
    @GetMapping("/findList")
    public Result<List<LazyNettyServerVisitorDTO>> findList(@ModelAttribute LazyNettyServerPermeatePortPoolQueryListCommand lazyNettyServerPermeatePortPoolQueryListCommand) {
        return lazyNettyServerPermeatePortPoolApplication.findList(lazyNettyServerPermeatePortPoolQueryListCommand);
    }

    /**
     * describe 分页查询多个服务端提前开放出来的端口
     *
     * @param lazyNettyServerPermeatePortPoolQueryListCommand 分页查询多个服务端提前开放出来的端口
     * @return {@link Result<LazyPage< LazyNettyServerVisitorDTO >>} 分页服务端提前开放出来的端口DTO对象
     * @author Jia wei Wu
     * @date 2024/01/16 02:21 下午
     **/

    @Operation(summary = "分页查询多个服务端提前开放出来的端口")
    @GetMapping("/findPage")
    public Result<LazyPage<LazyNettyServerVisitorDTO>> findPage(@Parameter(description = "分页大小") @RequestParam(defaultValue = "10", value = "size") int size,
                                                                @Parameter(description = "当前页数") @RequestParam(defaultValue = "1", value = "current") int current, @ModelAttribute LazyNettyServerPermeatePortPoolQueryListCommand lazyNettyServerPermeatePortPoolQueryListCommand) {
        return lazyNettyServerPermeatePortPoolApplication.findPage(size, current, lazyNettyServerPermeatePortPoolQueryListCommand);
    }

    /**
     * describe 删除服务端提前开放出来的端口
     *
     * @param lazyNettyServerPermeatePortPoolRemoveCommand 删除服务端提前开放出来的端口
     * @return {@link Result<  LazyNettyServerPermeatePortPool  >} 服务端提前开放出来的端口
     * @author Jia wei Wu
     * @date 2024/01/16 02:21 下午
     **/

    @Operation(summary = "删除服务端提前开放出来的端口")
    @DeleteMapping("/remove")
    public Result<LazyNettyServerPermeatePortPool> remove(@ModelAttribute LazyNettyServerPermeatePortPoolRemoveCommand lazyNettyServerPermeatePortPoolRemoveCommand) {
        return lazyNettyServerPermeatePortPoolApplication.remove(lazyNettyServerPermeatePortPoolRemoveCommand);
    }
}